<?php
class Employe_info_model extends CI_Model{

	function isLogin($username,$password){
		$this->db->where('username',$username);
		$this->db->where('password',$password);
		$data=$this->db->get('employe_info');
		if ($data->num_rows() > 0)
		return true;
		else
		return false;
	}

	function getEmployeInfo($num, $offset) {
		$query = $this->db->get('employe_info', $num, $offset);
		return $query;
	}

	function getAllEmployeInfo(){
		//$data=$this->db->get('entries');
		$data=$this->db->query('select * from employe_info order by employeid');
		return $data;
	}

	function delEmployeInfoById($id){
		$this->db->where('employeid',$id);
		$data=$this->db->delete('employe_info');
		return $data;
	}

	function getEmployeInfoById($id){
		$this->db->where('employeid',$id);
		$data=$this->db->get('employe_info');
		return $data;
	}

	function addEmployeInfo(){
		$data=array(
		//						'employeid'=>$_POST['employeid'],
						'username'=>$_POST['username'], 
						'password'=>$_POST['password'],
						'employena'=>$_POST['employena'],
						'email'=>$_POST['email'],
		);
		$this->db->insert('employe_info',$data);
		return $this->db->insert_id();
	}

	function  updateEmployeInfo($id,$data){
		$this->db->where('employeid',$id);
		$this->db->update('employe_info',$data);
	}
}
?>